import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router);

const routes = [
    {
        path:'/tc_shopmall_main',
        component:()=>import('./components/tc_shopmall/main.vue'),
        meta:{
            title:"main",
        },

        children:[
            {
                path:'/tc_shopmall_tj',
                component:()=>import('./components/tc_shopmall/tj.vue'),
                meta:{
                    title:"tj",
                }
            },   {
                path:'/tc_shopmall_cx',
                component:()=>import('./components/tc_shopmall/cx.vue'),
                meta:{
                    title:"cx",
                }
            }, {
                path:'/tc_shopmall_kc',
                component:()=>import('./components/tc_shopmall/kc.vue'),
                meta:{
                    title:"kc",
                },
                props:true
            }, {
                path:'/tc_shopmall_spbh',
                component:()=>import('./components/tc_shopmall/spbh.vue'),
                meta:{
                    title:"spbh",
                },
                props:true
            }
        ]

    },  {
        path:'/tc_shopmall_login',
        component:()=>import('./components/tc_shopmall/login.vue'),
        meta:{
            title:"login",
        }
    },  {
        path:'/tc_shopmall_bd',
        component:()=>import('./components/tc_shopmall/bd.vue'),
        meta:{
            title:"bd",
        }
    },  {
            path:'/product/Selstock',
            component:()=>import('./views/product/Selstock.vue'),
            meta:{
                title:"查看商品信息",
            }
        },{
            path: '/tc_client_Shopping Cart',
            component: () => import('./components/tc_client/Shopping Cart.vue'),
            meta: {
                title: "购物车",
            }
        }, {
            path: '/product/Joincom',
            component: () => import('./views/product/Joincom.vue'),
            meta: {
                title: "商品进货",
            }
        }, {
            path: '/product/Addcom',
            component: () => import('./views/product/Addcom.vue'),
            meta: {
                title: "商品添加",
            }
        }, {
            path: '/product/Secomdcom',
            component: () => import('./views/product/Secomdcom.vue'),
            meta: {
                title: "商品秒杀",
            }
        }, {
            path: '/product/Selallcom',
            component: () => import('./views/product/Selallcom.vue'),
            meta: {
                title: "添加秒杀商品",
            }
        },


        //店面管理后台管理
        {
            path: '/storefont_main',
            component: () => import('./views/storefront/home.vue'),
            meta: {
                title: '店面管理主页'
                //默认主页内容
            }, redirect: 'home_contet',
            //主页子项
            children: [
                {
                    path: '/solve_issue',
                    component: () => import('./views/storefront/second/solve_issue.vue'),
                    meta: {
                        title: '解决商品问题'
                    }
                }, {
                    path: '/unsolve_issue',
                    component: () => import('./views/storefront/second/unsolve_issue.vue'),
                    meta: {
                        title: '未解决商品问题'
                    }
                }, {
                    path: '/addnotice',
                    component: () => import('./views/storefront/notice/addnotice.vue'),
                    meta: {
                        title: '添加公告'
                    }
                }, {
                    path: '/updatenotice',
                    component: () => import('./views/storefront/notice/updatenotice.vue'),
                    meta: {
                        title: '修改公告'
                    }
                }, {
                    path: '/home_contet',
                    component: () => import('./views/storefront/home_contet.vue'),
                    meta: {
                        title: '默认主页内容'
                    }

                }, {
                    path: '/addslideshow',
                    component: () => import('./views/storefront/slideshow/addslideshow.vue'),
                    meta: {
                        title: '添加轮播图'
                    }
                }, {
                    path: '/addcommodity',
                    component: () => import('./views/storefront/commodity/addcommodity.vue'),
                    meta: {
                        title: '添加商品分类'
                    }
                }, {
                    path: '/makecommodity',
                    component: () => import('./views/storefront/commodity/makecommodity.vue'),
                    meta: {
                        title: '删改商品分类'
                    }
                },
                {
                    path: '/notice',
                    component: () => import('./views/storefront/notice/noticemanage.vue'),
                    meta: {
                        title: '公告管理'
                    }
                },
                {
                    path: '/salemanage',
                    component: () => import ('./views/storefront/sale/salemanage.vue'),
                    meta: {
                        title: '售后管理'
                    }

                }, {
                    path: '/par_order',
                    component: () => import('./views/storefront/profit/particular_order.vue'),
                    meta: {
                        title: '详细订单数'
                    }
                }, {
                    path: '/par_profit',
                    component: () => import('./views/storefront/profit/particular_profit.vue'),
                    meta: {
                        title: '详细盈利'
                    }
                }, {
                    path: '/manageAdmin',
                    component: () => import('./views/storefront/Administrator/manageAdmin.vue'),
                    meta: {
                        title: '管理员管理'
                    }
                }
            ]
        },
        {
            path: '/storefont_login',
            component:
                () => import('./views/storefront/login.vue'),
            meta:
                {
                    title: '店面管理登陆页面'
                }
        }

    ]
;


routes.forEach(route => {
    route.path = route.path || '/' + (route.name || '')
});

const router = new Router({routes});

router.beforeEach((to, from, next) => {
    const title = to.meta && to.meta.title;
    if (title) {
        document.title = title;
    }
    next();
});

export {
    router
};